//
// Created by Asukai on 2022/6/5.
//

#ifndef PTHREADPOOL_PTHREADPOOL_H
#define PTHREADPOOL_PTHREADPOOL_H

#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <unistd.h>


typedef struct ThreadPool ThreadPool;

//创建线程池并初始化
ThreadPool *threadPoolCreate(int min, int max, int queueSize);

//销毁线程池
int threadPoolDestroy(ThreadPool *pool);

//给线程池添加任务
void threadPoolAdd(ThreadPool *pool, void(*func)(void *), void *arg);

//获取当前线程池中的忙线程个数
int threadPoolBusyNum(ThreadPool *pool);

//获取当前线程池中存活线程个数
int threadPoolLiveNum(ThreadPool *pool);

//工作线程回调函数
void *worker(void *arg);

//管理者线程回调函数
void *manager(void *arg);

//线程退出
void threadExit(ThreadPool *pool);

#endif //PTHREADPOOL_PTHREADPOOL_H
